<?php
namespace Home\Model;
use Think\Model;
class UserModel extends Model {
  public function checkEamil($email)
  {
    //单引号包双引号不能解析变量
   // $res = $this->where('email="{$email}"')->find();
   // var_dump($res);
   // var_dump($this);
   $res = $this->where("email='{$email}'")->find();
   return $res;

  }
  public function checknickName($nickname)
  {
    // $res = $this->where('nickname="{$nickname}"')->find();
     $res = $this->where("nickname='{$nickname}'")->find();
    return $res;
  }
  public function checkLogin($email,$password)
  {

    // md5($password);
    // $sql = "select * from user where email = '{$email}' and password = {'$password'}";;
    // $this->query($sql);
    $data = array(
      'email'=> $email,
      'password'=> md5($password)
      );
    return $this->where($data)->find();
  }
}